load("//bazel:tachyon_cc.bzl", "tachyon_cc_library", "tachyon_cc_unittest")

package(default_visibility = ["//visibility:public"])

tachyon_cc_library(
    name = "duplex_sponge_mode",
    hdrs = ["duplex_sponge_mode.h"],
    deps = ["//tachyon/base/buffer:copyable"],
)

tachyon_cc_library(
    name = "padding_free_sponge",
    hdrs = ["padding_free_sponge.h"],
    deps = [
        ":sponge",
        "//tachyon/crypto/hashes:hasher",
    ],
)

tachyon_cc_library(
    name = "sponge",
    hdrs = ["sponge.h"],
    deps = [
        ":duplex_sponge_mode",
        ":sponge_state",
        "//tachyon/base:logging",
        "//tachyon/base/buffer:copyable",
        "//tachyon/math/finite_fields:finite_field_traits",
    ],
)

tachyon_cc_library(
    name = "sponge_state",
    hdrs = ["sponge_state.h"],
    deps = [
        ":duplex_sponge_mode",
        "//tachyon/base/strings:string_util",
        "//tachyon/math/matrix:matrix_types",
    ],
)

tachyon_cc_library(
    name = "truncated_permutation",
    hdrs = ["truncated_permutation.h"],
    deps = [
        ":sponge",
        "//tachyon/crypto/hashes:compressor",
    ],
)

tachyon_cc_unittest(
    name = "sponge_unittests",
    srcs = [
        "duplex_sponge_mode_unittest.cc",
        "padding_free_sponge_unittest.cc",
        "truncated_permutation_unittest.cc",
    ],
    deps = [
        ":duplex_sponge_mode",
        ":padding_free_sponge",
        ":truncated_permutation",
        "//tachyon/base/buffer:vector_buffer",
        "//tachyon/base/containers:container_util",
        "//tachyon/crypto/hashes/sponge/poseidon2",
        "//tachyon/crypto/hashes/sponge/poseidon2:poseidon2_params",
        "//tachyon/crypto/hashes/sponge/poseidon2/param_traits:poseidon2_baby_bear",
        "//tachyon/math/finite_fields/test:finite_field_test",
    ],
)
